package com.doit.day01;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Tuple;

import java.util.Set;

//需要获取排名前三的英雄和次数
public class GetHeroData {
    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = new Jedis("linux01", 6379);

        while (true){
            //Tuple   元祖   scala里面
            Set<Tuple> heros = jedis.zrevrangeWithScores("hero", 0, 2);
            for (Tuple tuple : heros) {
                double score = tuple.getScore();
                String hero = tuple.getElement();
                System.out.println("英雄是："+hero +",出场次数是："+score);
            }
            Thread.sleep(3000);
            System.out.println("===================帅气的分割线=============================");

        }



    }
}
